//#define __DEBUG__
// by Tyrghen
#define THIS_FILE "fnc_afunc.sqf"
#include "x_setup.sqf"

#ifndef __ACE__
private ["_objs","_member"];
_member = if (isnil "mp_rights_fnc_hasRoles") then {false} else {[player] call mp_rights_fnc_isMember};
if (vehicle player == player) then {
	GVAR(objectID2) = objNull;
	_objs = nearestObjects [player, ["LandVehicle","Air"], 7];
	if (count _objs > 0) then { GVAR(objectID2) = _objs select 0; };
	if (alive GVAR(objectID2)) then {
		if (_member) then {
			true;
		} else {
			((damage GVAR(objectID2) > 0.02 || !canMove GVAR(objectID2) || {fuel GVAR(objectID2) < 1}) && ("ToolKit" in (items player) || GVAR(string_player) in GVAR(is_engineer)))
		};
	} else {
		false
	}
} else {
	false
}
#else
private ["_objs","_member"];
_member = if (isnil "mp_rights_fnc_hasRoles") then {false} else {[player] call mp_rights_fnc_isMember};
if (vehicle player == player && {(player call ace_sys_ruck_fnc_hasRuck)}) then {
	GVAR(objectID2) = objNull;
	_objs = nearestObjects [player, ["LandVehicle","Air"], 7];
	if (count _objs > 0) then { GVAR(objectID2) = _objs select 0; };
	if (alive GVAR(objectID2)) then {
		if (_member) then {
			true;
		} else {
			((damage GVAR(objectID2) > 0.05 || !canMove GVAR(objectID2) || {fuel GVAR(objectID2) < 1}) && ("ToolKit" in (items player) || GVAR(string_player) in GVAR(is_engineer)))
		};
	} else {
		false
	}
} else {
	false
}
#endif